def cache_deco(func):
    cache = {}
    def wrapper(*args, **kwargs):
        if args not in cache:
            cache[args] = func(*args, **kwargs)
            print(cache)
        return cache[args]
    return wrapper


# 使用装饰器来为斐波那契函数添加缓存
# 斐波那契函数递归工具
@cache_deco
def fibonacci_recursion_tool(n):
    print("called")
    if n <= 1:
        return n
    else:
        return fibonacci_recursion_tool(n - 1) + fibonacci_recursion_tool(n - 2)

print(fibonacci_recursion_tool(10))

